﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StarsiSeznam.aspx.cs" Inherits="Sio.Mdm.Web.Organizacija.StarsiSeznam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>SIO - MDM :: Organizacija : Starši</title>

    <script type="text/javascript">
        var spoliRenderer = function(value) {
            var r = StoreSpoli.getById(value);
            if (Ext.isEmpty(r)) { return ""; }
            return r.data.Naziv;
        };
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Store ID="StoreSpoli" runat="server">
        <reader>
				<ext:ArrayReader IDProperty="SpolID">
					<Fields>
						<ext:RecordField Name="SpolID" Type="Int" />
						<ext:RecordField Name="Naziv" Type="String" />
					</Fields>
				</ext:ArrayReader>
			</reader>
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server" Layout="Fit">
        <content>
		                    
		<sio:GridPanel ID="GridStarsiSeznam" runat="server" 
			StripeRows="true"
			TrackMouseOver="true"
			Width="700">
     <Plugins>
			<ext:RowEditor ID="RowEditor1" runat="server" SaveText="Shrani" CancelText="Prekliči" ClicksToEdit="2">
				<DirectEvents>
					<AfterEdit OnEvent="UrediPodatke">
						<ExtraParams>
							<ext:Parameter Mode="Raw" Name="data" Value="r.data" />
						</ExtraParams>
					</AfterEdit>
				</DirectEvents>
			</ext:RowEditor> 
			<ext:GridFilters ID="GridFilters1" runat="server">
				<Filters>
					<ext:StringFilter DataIndex="Ime" />
					<ext:StringFilter DataIndex="Priimek" />
					<ext:NumericFilter DataIndex="IdmStevilka" />
				</Filters>
			</ext:GridFilters>	
      </Plugins>
			
		<Store>
			<ext:Store ID="StoreStarsiSeznam" runat="server">
			<SortInfo Field="Priimek" />
			<Reader>
				<ext:JsonReader IDProperty="IdmStevilka">
					<Fields>
						<ext:RecordField Name="IdmStevilka" Type="Int" />
						<ext:RecordField Name="VlogaId" Type="Int" />
						<ext:RecordField Name="Ime" Type="String" />
						<ext:RecordField Name="Priimek" Type="String" />
						<ext:RecordField Name="Telefon" Type="String" />
						<ext:RecordField Name="TelefonSluzba" Type="String" />
						<ext:RecordField Name="Spol" Type="Int" />
					</Fields>
				</ext:JsonReader>
			</Reader>
			</ext:Store>
		</Store>
	    
		<ColumnModel ID="ColumnModel1" runat="server">
		<Columns>
			<ext:RowNumbererColumn />
			<ext:Column ColumnID="IdmStevilka" Header="IdmStevilka" Hidden="false" Hideable="false" DataIndex="IdmStevilka" Width="50"></ext:Column>
			<ext:Column ColumnID="Ime" Header="Ime" DataIndex="Ime" Width="100">
        <Editor><ext:TextField runat="server" AllowBlank="false" MinLength="2" MinLengthText="Vpišite ime" BlankText="Vpišite ime" /></Editor>
      </ext:Column>
			<ext:Column Header="Priimek" DataIndex="Priimek" Width="100">
        <Editor><ext:TextField runat="server" AllowBlank="false" MinLength="2" MinLengthText="Vpišite priimek" BlankText="Vpišite priimek" /></Editor>
      </ext:Column>
			<ext:Column Header="Spol" DataIndex="Spol" Width="100">
				<Renderer Fn="spoliRenderer" />
				<Editor><ext:ComboBox ID="cbSpoli" runat="server" TypeAhead="true" SelectOnFocus="true" Editable="true" Mode="Local" ForceSelection="true" 
						StoreID="StoreSpoli" ValueField="SpolID" DisplayField="Naziv" /></Editor>
      </ext:Column>
			<ext:Column Header="Telefon" DataIndex="Telefon" Width="100">
        <Editor><ext:TextField ID="TextField1" runat="server" AllowBlank="true" /></Editor>
      </ext:Column>
      <ext:Column Header="Službeni telefon" DataIndex="TelefonSluzba" Width="100">
        <Editor><ext:TextField ID="TextField2" runat="server" AllowBlank="true" /></Editor>
      </ext:Column>

      <ext:CommandColumn Width="35">
        <Commands>
          <ext:GridCommand Icon="NoteEdit" CommandName="Uredi"><ToolTip Text="Uredi" /></ext:GridCommand>
        </Commands>
       </ext:CommandColumn>
		</Columns>
		</ColumnModel>
		<Listeners>
		  <Command Handler="openTab('../Uporabnik/Akter.aspx', 'Starš '+record.data.Ime+' '+record.data.Priimek, {idm: record.id }, 'akter'+record.id);" />
		</Listeners>
		
		<SelectionModel>
			<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
		</SelectionModel>
		
		<TopBar>
			<ext:Toolbar ID="Toolbar1" runat="server" Width="500">
			<Items>				
				<sio:Button runat="server" ID="Remove"
					Text="Odstrani"
					Icon="Delete">
				<DirectEvents>
					<Click OnEvent="OdstraniStarse" After="#{StoreStarsiSeznam}.reload();" >
					<Confirmation ConfirmRequest="true" Message="Izbrišem izbrane starše?" />
					<ExtraParams>
						<ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridStarsiSeznam}.getRowsValues({selectedOnly:true}))" />
					</ExtraParams>					
					</Click>
				</DirectEvents>						
				</sio:Button>
			</Items>
			</ext:Toolbar>
		</TopBar>
		
		</sio:GridPanel>
    
	</content>
    </ext:Viewport>
    </form>
</body>
</html>
